package cn.zhentao.service.impl;

import cn.zhentao.dao.UserDao;
import cn.zhentao.pojo.Address;
import cn.zhentao.pojo.User;
import cn.zhentao.service.UserService;
import cn.zhentao.vo.UserVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public User findByUserNameAndPassWordUser(String username, String password) {
        return userDao.findByUserNameAndPassWordUser(username,password);
    }

    @Override
    public int addAddress(Address address) {
        return userDao.addAddress(address);
    }

    @Override
    public List<Address> findAllAddress(int userId) {
        return userDao.findAllAddress(userId);
    }

    @Override
    public int insertUser(User user) {
        return userDao.insertUser(user);
    }

    @Override
    public List<UserVo> findAllByRoleId(int userId) {
        return userDao.findAllByRoleId(userId);
    }

    @Override
    public int updateAddress(Address address) {
        return userDao.updateAddress(address);
    }

    @Override
    public List<Address> findAllAddressByUserId() {
        return userDao.findAllAddressByUserId();
    }
}
